#include "objects/TestObject.h"

TestObject::TestObject( GameScene& theGame )
   : GameObject::GameObject( theGame ),
     visible( true )
{
	sprite.SetOrigin( 12, 12 );
	sprite.SetPosition( 320 / 2, 240 / 2 );
	std::cout << Game.App.GameResources[ "object test" ] << std::endl;
	sprite.SetImage( ( * Game.App.Images.GetResource( Game.App.GameResources[ "object test" ] ) ) );
}

void TestObject::Draw( gdn::Window& window )
{
	if ( visible )
	{
		GameObject::Draw( window );
	}
}

void TestObject::GlobalMousePress( const gdn::Vector2f& clickPos, const gdn::Mouse::Button& clickButton )
{
	sprite.SetPosition( clickPos.x, clickPos.y );
}

void TestObject::GlobalMouseRelease( const gdn::Vector2f& clickPos, const gdn::Mouse::Button& clickButton )
{
	sprite.SetPosition( clickPos.x, clickPos.y );
}

void TestObject::GlobalMouseMove( const gdn::Vector2f& mousePos )
{
	if ( mousePressed )
	{
		sprite.SetPosition( mousePos.x, mousePos.y );
	}
}

void TestObject::GlobalKeyPress( const gdn::Key::Code key )
{
	if ( key == gdn::Key::V )
	{
		visible = false;
	}
}

void TestObject::GlobalKeyRelease( const gdn::Key::Code key )
{
	if ( key == gdn::Key::V )
	{
		visible = true;
	}
}
